package io.jjz.controller;

import io.jjz.dao.CrudDao;
import org.apache.hadoop.hbase.util.Bytes;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.Flow;

@RestController
public class TestController {

    @Resource
    private CrudDao crudDao;

    @GetMapping("/test")
    public String test() {
        final byte[] cell = crudDao.getCell("taxi_ride",
                Bytes.toBytes("2013000001|2013000001|9223370679853375807"), "d", "start");
        System.out.println(Bytes.toBoolean(cell));

        final Map<byte[], byte[]> cells = crudDao.getCells("taxi_ride",
                Bytes.toBytes("2013000001|2013000001|9223370679853375807"), "d");
        for (Map.Entry<byte[], byte[]> entry : cells.entrySet()) {
            System.out.println(Bytes.toString(entry.getKey()) + " -- " + Bytes.toHex(entry.getValue()));
        }
        return "ok";
    }

}
